package com.ch.dream.asynctask;

import org.json.JSONObject;

import android.content.Context;

import com.ch.dream.base.BaseRequestAsyncTask;
import com.ch.dream.common.CommonData;
import com.ch.dream.common.CommonRequestUrl;
import com.ch.dream.net.MyHttpAPI;
import com.ch.dream.tools.UtilTools;

public class GetTimeRequestAsyncTask  extends BaseRequestAsyncTask {

	private MyHttpAPI myHttpAPI = new MyHttpAPI(CommonRequestUrl.GETTIME);
	public GetTimeRequestAsyncTask(Context context, RequestServerListener requestServerListener){
		super(context, requestServerListener);
	}
	@Override
	protected Object doInBackground(Object... arg0) {
		try{
			JSONObject jsonObject = myHttpAPI.requestForJson();
			CommonData.SERVICETIME = jsonObject.get("result").toString();
			UtilTools.setStringSharedPreferences(context, CommonData.MYDATE,"date", CommonData.SERVICETIME);
			CommonData.GETTIMEOVERFLAG =true;
			return jsonObject;
		}catch (Exception e) {
			e.printStackTrace();
		}
		
		return null;
	}
}
